<?php

require_once 'phpmoko/ui/Widget.php';

class FormPanel extends Widget
{
	private $widget = null;
	private $script = null;

	function __construct()
	{
		parent::__construct();
	}

	function setScript($script)
	{
		$this->script = $script;
	}

	function setWidget($widget)
	{
		if ($widget instanceof Widget)
			$this->widget = $widget;
		else
			$this->widget = new HTML($widget);
	}

	function toString()
	{
		$str = '<form ';

		if ($this->id != null)
			$str .= ' id="'.$this->id.'"';

		$str .= ' action="'.$this->script.'" enctype="multipart/form-data" method="post">';
		$str .= '<fieldset>';
		$str .= $this->widget->toString();
		$str .= '</fieldset>';
		$str .= '</form>';

		return $str;
	}
}
?>